package com.xydpeng.rpc.serialize;

import com.xydpeng.rpc.serialize.support.hessian.HessianSerialization;
import com.xydpeng.rpc.serialize.support.json.JacksonSerialization;
import com.xydpeng.rpc.serialize.support.protostuff.ProtostuffSerialization;

/**
 * @author xydpeng
 * @version v1.0
 * @date: 2023/4/13
 * @description:
 */
public class SerializationFactory {

    public static Serialization getInstance(SerializationType type) {
        switch (type) {
            case HESSIAN:
                return HessianSerialization.getInstance();
            case PROTOSTUFF:
                return ProtostuffSerialization.getInstance();
            case JSON:
                return JacksonSerialization.getInstance();
        }
        throw new IllegalArgumentException("serialization type is illegal:" + type);
    }


}
